﻿
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>

/*
 * ./zmq_sr501_test /dev/zmq_sr501
 *
 */

int main(int argc, char **argv)
{

	int fd, ret;
	int cnt = 0;
	int val = 0;

	if (argc != 2)
	{
		printf("Usage: %s <dev>\n", argv[0]);
		return -1;
	}
	
	fd = open(argv[1], O_RDWR);
	if (fd == -1)
	{
		printf("Open %s err.\n", argv[1]);
		return -1;
	}
	
	while(1)
	{
			
		if (read(fd, &val, 4) == 4)
			printf("get signal: 0x%x\n", val);
		else
			printf("get signal: -1\n");
	}

	close(fd);
	return 0;
}


